package com.it.common.utils

object TimeTaskUtils {
    private val taskMap by lazy { HashMap<String, CommonRxTimerTask>() }

    fun getTimeTask(id: String): CommonRxTimerTask {
        removeTimeTask(id)
        val task = CommonRxTimerTask()
        taskMap[id] = task
        return task
    }

    /**
     * 移除定时器
     * @param id String
     */
    fun removeTimeTask(id: String) {
        taskMap[id]?.cancel()
        taskMap.remove(id)
    }

}